
/*
	调用自定义中间件
*/

var express = require('express');
var middleware = require('./middleware');
var app = express();



/*
	默认对'/'应用中间件
	http://localhost:1337/
*/
/*app.use(middleware.setHeader());
app.get('/', function(req, res){
	console.log(res.statusCode, res.header, res.head)
	res.writeHead(res.statusCode, res.header);
	res.write(res.head);
	res.end('你好');
});*/





/*
	用于指定只对'/static'应用中间件
	http://localhost:1337/static
	http://localhost:1337/static/xxx
*/
/*app.use('/static', middleware.setHeader());
app.get('/*', function(req, res){
	console.log(res.statusCode, res.header, res.head)
	res.writeHead(res.statusCode, res.header);
	res.write(res.head);
	res.end('你好');
});*/




app.listen(1337, 'localhost');



